<?php //pack11class

class SearchSelectsResponder extends Module {

    public function setup() {
           //echo "responder";
           $this->generate(PropertiesManager::getProperty(GetPost::value("current")));
           //echo $this->body;
    }

    private function generate(Property $property) {
        if(get_class($property)!="Property") {
            echo "Not a property!";
            return;
        }

        $options=$property->availableValues(true);
        if(count($options)==0) {
            echo "<!-- 0 -->";
            return false;
        }

        $option=new SelectOption;
        $option->label=LabelManager::getLabel("searchSelectNull");
        $option->value=0;
        if(!$property->value) $option->selected=SelectOption::SELECTED;
        $this->addChild($option);

        foreach($options as $value) {
            $option=new SelectOption;
            $option->label=$value->value;
            $option->value=$value->id;
            if($property->value==$value->id) $option->selected=SelectOption::SELECTED;
            $this->addChild($option);
        }
    }
    
}
?>
